import {
	login,
} from '@/api/user'

let state = {
	level: 0,
	activeCard: {},
	activeCardList: []
}


const mutations = {
	SET_TOKEN: (state, token) => {
		state.token = token
	},
	SET_ACTIVE_CARD: (state, activeCard) => {
		state.activeCard = activeCard
	},
	SET_CARD_LIST: (state, activeCardList) => {
		state.activeCardList = activeCardList
	}
}

const actions = {
	// 使用vuex存储首页激活card信息
	activeCardList({
		commit
	}, data) {
		
		return new Promise((resolve, reject) => {
			
			if(data.length>0){
				commit('SET_CARD_LIST', data)
				resolve('sucess')
			}else{
				reject()
			}
			
		})
	},
	// 使用vuex存储首页激活card信息
	activeCard({
		commit
	}, data) {

		return new Promise((resolve, reject) => {
			
			if(data.length>0){
				commit('SET_ACTIVE_CARD', data)
				resolve('sucess')
			}else{
				reject()
			}
			
		})
	},

}

export default {
	namespaced: true,
	state,
	mutations,
	actions
}